<%
# Logs plugin for Redmine
# Copyright (C) 2011  Haruyuki Iida
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
%>

<% if @error -%>
  <div class="flash error"><%= @error -%></div>
<% end -%>

<div class="contextual">
  <span class="icon icon-save">
    <% form_id = "download_id_#{rand(10000)}" -%>
    <%= form_tag({:action => 'download'}, {:id => form_id}) do%>
      <%= hidden_field_tag :path, @path %>
      <%= link_to_function l(:button_download),  "$('##{form_id}').submit()"%>
    <% end -%>
  </span>

  <span class="icon icon-del">
    <% form_id = "delete_id_#{rand(10000)}" -%>
    <%= form_tag({:action => 'delete'}, {:id => form_id}) do%>
      <%= hidden_field_tag :path, @path %>
      <%= link_to_function l(:button_delete),  "if(confirm('#{escape_javascript(l(:text_are_you_sure))}')){$('##{form_id}').submit();}"%>
    <% end -%>
  </span>
</div>
<h2>Log: <%= h(@path) %> </h2>
<div id="redmine_log_show">
  <pre>
    <%= h(@log) %>
  <pre>
</div>

<% content_for :header_tags do %>
   <%= stylesheet_link_tag "logs.css", :plugin => "redmine_logs", :media => "screen" %>
<% end %>